<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="string" uri="http://jakarta.apache.org/taglibs/string-1.1" %>
<%@ taglib uri="/WEB-INF/tlds/pagination.tld" prefix="pagination" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Report</title>
    <script type="text/javascript" src="/common/js/common.js"></script>
    <script type="text/javascript">
        function browsercheck(){
            var UserAgent=navigator.userAgent;
            if(UserAgent.match(/iPhone/) ){
                return "1";
            }
            else if(UserAgent.match(/Android/)){
                return "2";
            }else{
                return "3";
            }
        }

        function mobileFaq() {
            var TheForm = document.frm;
            TheForm.browserType.value = browsercheck();
            alert(TheForm.browserType.value);
            TheForm.action = "/faq.do";
            TheForm.submit();
        }

        function jsSendReport() {
            var TheForm = document.frm;
//            alert(TheForm.reasonKey.value);
//            alert(TheForm.reasonDetail.value);
//            TheForm.nextTarget.value = "sendMailResult";
            TheForm.action = "/communityBoardReport.do";
            TheForm.submit();
        }

        function jsTypeReason(key){
//            alert(document.getElementById("reasonDetail").value);
            if(key == 'R0'){
                document.getElementById("reasonDetail").value = "";
                document.getElementById("reasonDetail").disabled = false;
            }else{
                document.getElementById("reasonDetail").value = "<spring:message code="communityReport.textArea" />";
                document.getElementById("reasonDetail").disabled = true;
            }
        }

        function jsReportLoaded(){
            if(document.frm.closing.value == 'closing'){
                alert('<spring:message code="communityReport.alert1" />');
                window.opener='self';
                window.open('','_parent','');
                window.close();
            }
            if(document.frm.reported.value == 'true'){
                alert('<spring:message code="communityReport.alert2" />');
                window.opener='self';
                window.open('','_parent','');
                window.close();
            }
        }


    </script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="jsReportLoaded();">

<div align="center">
    <form name="frm" method="POST">
        <input type="hidden" name="mailType" value="2">
        <input type="hidden" name="nextTarget" value="">
        <input type="hidden" name="boardno" value="${content_no}" >
        <input type="hidden" name="page" value="${page}" >
        <input type="hidden" name="closing" value="${closing}" >
        <input type="hidden" name="reported" value="${reported}" >
        <div class="mainFrame" style="background-color: #FFFFFF;width: 100%;font-size: 11px;">
            <p style="padding: 20px; font: 12px bold; color: #000000;"><spring:message code="communityReport.title" /></p>
            <p>
            <select id="reasonKey" name="reasonKey" onchange="jsTypeReason(this.value)" >
                <option  value="R1"><spring:message code="communityReport.r1" /></option>
                <option  value="R2"><spring:message code="communityReport.r2" /></option>
                <option  value="R3"><spring:message code="communityReport.r3" /></option>
                <option  value="R4"><spring:message code="communityReport.r4" /></option>
                <option  value="R5"><spring:message code="communityReport.r5" /></option>
                <option  value="R0"><spring:message code="communityReport.r6" /></option>
            </select>
            </p>
            <p><textarea id="reasonDetail" name="reasonDetail" cols='20' disabled="disabled" wordwrap style="width: 350px; height: 180px;" ><spring:message code="communityReport.textArea" /></textarea></p>
                <%--<input type="text" id="reasonDetail" name="reasonDetail" />--%>

            <%--<input type="text" id="reasonDetail" name="reasonDetail" enabled="true" style="display: none" />--%>
            <%--<p>ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" name="fPassword_id"></p>--%>
            <%--<p>EMAIL <input type="text" name="fPassword_email"><br>--%>
                <font style="size: 7px; color: gray;"><br>
                    <%--광고성 글 // 비방성 글 // 욕설 // 도배(같은 글 반복) // <br>--%>
                    <%--사유 직접 입력<br>--%>
                    <font style="size: 8px; color: red">
                        <spring:message code="communityReport.bottom" />
                        <br/><br/>
                    </font>
                </font>
            <p><a href="javascript:jsSendReport()"><spring:message code="communityReport.report" /></a></p>
        </div>
    </form>

</div>
</body>
</html>